package cc.iotkit.data.service.impl;

import cc.iotkit.data.mapper.IotContributorMapper;
import cc.iotkit.data.model.TbIotContributor;
import cc.iotkit.data.service.IotContributorService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 石恒
 * @Date: 2023/8/3 22:19
 * @Description:
 */
@Service("DBIotContributorServiceImpl")
@Primary
public class IotContributorServiceImpl extends ServiceImpl<IotContributorMapper, TbIotContributor> implements IotContributorService {

    @Override
    public List<TbIotContributor> findByConditions(LambdaQueryWrapper<TbIotContributor> lambdaQueryWrapper) {
        return this.baseMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public TbIotContributor findOneByConditions(LambdaQueryWrapper<TbIotContributor> lambdaQueryWrapper) {
        return this.baseMapper.selectOne(lambdaQueryWrapper);
    }

    @Override
    public Page<TbIotContributor> findPageByConditions(LambdaQueryWrapper<TbIotContributor> lambdaQueryWrapper, int page, int size) {
        Page<TbIotContributor> rowPage = new Page<>(page, size);
        return this.baseMapper.selectPage(rowPage, lambdaQueryWrapper);
    }
}
